#include "main/utils.h"
using namespace std;

void permutesCore(vector<int>& nums, int index, vector<vector<int>>& results) {
  if (index == nums.size()) {
    results.push_back(nums);
    return;
  }
  for (int i = index; i < nums.size(); ++i) {
    swap(nums, i, index);
    permutesCore(nums, index + 1, results);
    swap(nums, i, index);
  }
}

vector<vector<int>> permutes(vector<int> nums) {
  vector<vector<int>> results;
  permutesCore(nums, 0, results);
  return results;
}

int main() {
  vector<int> nums = {1, 2, 3};
  auto ret = permutes(nums);
  printVec("o83", ret);

  return 0;
}
